package com.nineclock.system.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.system.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private SmsService smsService;

    /**
     * 手机验证码验证
     *
     * @param
     * @return
     */
    @GetMapping("/verify")
    public Result loginVerify(@RequestParam("mobile") String mobile, @RequestParam("checkcode") String checkcode, @RequestParam("type") String type) {
        return smsService.verify(mobile, type, checkcode);
    }

    /**
     * 登录发送验证码
     *
     * @param mobile
     * @param type
     * @return
     */
    @GetMapping("/code")
    public Result sendCode(@RequestParam("mobile") String mobile, @RequestParam("type") String type) {
        return smsService.sendCode(mobile, type);
    }

}
